package io.chenglicun.modules.clc.service.dataset.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.chenglicun.common.service.impl.CrudServiceImpl;
import io.chenglicun.common.constant.Constant;
import io.chenglicun.modules.clc.dao.dataset.ViewDataSetColumnDao;
import io.chenglicun.modules.clc.dto.dataset.ViewDataSetColumnDTO;
import io.chenglicun.modules.clc.entity.dataset.ClcDataSetColumnEntity;
import io.chenglicun.modules.clc.entity.dataset.ViewDataSetColumnEntity;
import io.chenglicun.modules.clc.service.dataset.ViewDataSetColumnService;
import io.chenglicun.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * VIEW
 *
 * @author HB 137664951@qq.com
 * @since 1.0 2024-03-21
 */
@Service
public class ViewDataSetColumnServiceImpl extends CrudServiceImpl<ViewDataSetColumnDao, ViewDataSetColumnEntity, ViewDataSetColumnDTO> implements ViewDataSetColumnService {

    @Override
    public QueryWrapper<ViewDataSetColumnEntity> getWrapper(Map<String, Object> params) {
        QueryWrapper<ViewDataSetColumnEntity> wrapper = new QueryWrapper<>();
        if (params.get("setid") != null && StringUtils.isNotEmpty(params.get("setid").toString()))
            wrapper.lambda().eq(ViewDataSetColumnEntity::getDataSetId, params.get("setid"));

        wrapper.lambda().orderByAsc(ViewDataSetColumnEntity::getSort);
        return wrapper;
    }


}